package org.onvivals.common.exception;

import cn.hutool.http.HttpStatus;

import java.io.Serial;

/**
 * 自定义异常
 */
public class BusinessException extends RuntimeException {

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 返回给前端的错误code
     */
    private int errCode = HttpStatus.HTTP_INTERNAL_ERROR;

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(String message, int errCode) {
        super(message);
        this.errCode = errCode;
    }

    public int getErrCode() {
        return errCode;
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }
}
